package miniBanco.Gui;

import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;

import miniBanco.Dto.UsuarioDTO;
import MySwing.JFormField;

public class WinLoginUsuario extends JDialog {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JButton buttonAceptar;
	private JFormField textUsuario;
	private JFormField textPassword;
	private JPanel panel;
	private BorderLayout borderLayout;
	public Boolean ReturnValue;
	public WinLoginUsuario()
	{
		panel = new JPanel();
		buttonAceptar = new JButton();
		buttonAceptar.setText("Aceptar");
		
		borderLayout = new BorderLayout();
		textUsuario = new JFormField("Usuario", 25);

		textPassword = new JFormField("Password", 25);

		panel.setLayout(borderLayout);
		panel.add(textUsuario,BorderLayout.NORTH);
		panel.add(textPassword,BorderLayout.CENTER);
		panel.add(buttonAceptar,BorderLayout.SOUTH);

		this.setModalityType(ModalityType.APPLICATION_MODAL);
        getContentPane().add(panel);
        pack();
        setLocationRelativeTo(null);
	}
	
	public JButton getButtonAceptar()
	{
		return buttonAceptar;
	}
	
	public UsuarioDTO getFormValues()
	{
		UsuarioDTO userDTO = new UsuarioDTO();
		String userName;
		String password;
		userName = textUsuario.getTextField().getText();
		password = textPassword.getTextField().getText();
		userDTO.setPassword(password);
		userDTO.setUsername(userName);
		return userDTO;
	}
}
